<%@page import="com.oceansoft.core.common.constant.Constant"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Page-Exit" content="revealTrans(Duration=0.1,Transition=2)"/>
		<meta http-equiv="Page-Enter" content="revealTrans(Duration=0.1,Transition=2)"/>
		<title>苏州公安综合管理工作平台—涉案财物</title>
		<link rel="stylesheet" type="text/css" href="<c:url value='/resource/css/CSS_style.css'/>" />
		<%
		session.setAttribute(Constant.LOGIN_USER, null);
		//session.setMaxInactiveInterval(0);
		
		String u= request.getHeader("host");
		if(u.indexOf(":")>-1)
		{
		 u=u.substring(0,u.indexOf(":"));
		}
		String ctx = request.getContextPath();
		String url = request.getRequestURI();
		String code = request.getRemoteUser();
	    %>  
		<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.7.2.min.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/jquery-caplocktip.js'/>"></script>
	<title>苏州市公安局科技服务之窗</title>
<style>
dl, dd, dt, ul, li {
	margin:0px;
	padding:0px;
}
body {
	margin:0px;
	padding:0px;
	background:url(<%=path%>/resource/images/login/login_bg.jpg) center top no-repeat fixed;
	background-color:#133261;
}
.login_form {
	width:650px;
	height:420px;
	margin:160px auto 0 auto;
	background: url(<%=path%>/resource/images/login/login_03.png) left top no-repeat;
	padding:150px 0 0 55px;
	
}
.dl_bt {
	display:block;
}
.dl_bt dd {
	padding:4px 0;
	width:540px;
	height:36px;
	border:1px solid #d2dbe2;
	float:left;
	margin:10px 0;
}
.login_name {
	background:url(<%=path%>/resource/images/login/login_03.gif) 15px center no-repeat;
}
.login_password {
	background:url(<%=path%>/resource/images/login/login_06.gif) 15px center no-repeat;
}
.dl_bt dd span {
	padding: 0 10px 0 50px;
	display:block;
	float:left;
	height:36px;
	line-height:36px;
	font-family:"微软雅黑", Verdana, Geneva, sans-serif;
	color:#999999;
}
.dl_bt dd .lgpt {
	width:440px;
	height:34px;
	line-height:34px;
	border:0px;
}
.ibut {
	width:208px;
	height:56px;
	border:0px;
	background-color:#3175c0;
	font-size:18px;
	color:#FFF;
	font-family:"微软雅黑", Verdana, Geneva, sans-serif;
	cursor:pointer;
	margin-top:15px;
}
.key {
	margin-left:122px;
}
</style>

<!--[if IE 6]>
<script src="<c:url value='/resource/js/DD_belatedPNG.js'/>"></script>
<script>
  DD_belatedPNG.fix('.login_form');
</script>
<![endif]-->
		<script type="text/javascript">
		var dispsw = "";
			var debounce = function (func, threshold, execAsap) {  
			    var timeout;  
			    return function debounced () {  
			        var obj = this, args = arguments;  
			        function delayed () {  
			            if (!execAsap)  
			            func.apply(obj, args);  
			            timeout = null;  
			        };  
			        if (timeout)  
			            clearTimeout(timeout);  
			        else if (execAsap)  
			            func.apply(obj, args);  
			        timeout = setTimeout(delayed, threshold || 100);  
			    };  
			};
			window.onresize = debounce(function(){  
			   $("#main").css("margin-top",($(window).height()-500)/2-30);
			}, 100, true);
			
			function isBlank(targetCmpId,msgCmpId,msg){
				if ("" == $("#"+targetCmpId).val().replace(/(^\s*)|(\s*$)/g, "")) {
					//$("#btn_login").css("top","340px");
					//$("#keylogin").css("top","340px");
					$("#"+msgCmpId).text(msg);
					return false;
				}else{
					$("#"+msgCmpId).text("");
					return true;
				}
			}
			
			function trimStr(targetCmpId){
				return $("#"+targetCmpId).val().replace(/(^\s*)|(\s*$)/g, ""); 
			}
		
			document.onkeydown = function() {
				if (13 == event.keyCode) {
					if(isBlank("username","pwdErr","请输入用户名！") && isBlank("password","userErr","请输入密码！")){
						$.post("<c:url value='/profile/auth.json'/>",{policeNum:trimStr("username"),password:trimStr("password")},function(data){
							//alert(data.msg.title)
							
							if(1 == data.msg.status){
								//$("#btn_login").css("top","340px");
								//$("#keylogin").css("top","340px");
								window.location.replace("<c:url value='/profile/admin.html'/>");
							}else{
								//$("#btn_login").css("top","340px");
								//$("#keylogin").css("top","340px");
								$("#pwdErr").text(data.msg.body);
								dispsw = data.msg.extentData ;
							}
						});
					}
				}
			};
			$(function(){
			 if("${data}"!=""){
			 $("#pwdErr").text("${data}");
			 };
			 
			 $("#pwdErr").css("left",($(window).width()-240)/2-30);
			 
			});
			$(function(){
				$("#btn_login").click(function(){
					if(isBlank("username","pwdErr","请输入用户名！") && isBlank("password","pwdErr","请输入密码！")){
						$.post("<c:url value='/profile/auth.json'/>",{policeNum:trimStr("username"),password:trimStr("password")},function(data){
							//alert(data.msg.title)
							if(1 == data.msg.status){
							//	$("#btn_login").css("top","340px");
							//	$("#keylogin").css("top","340px");
							 	window.location.replace("<c:url value='/profile/admin.html'/>");
							}else{
								//$("#btn_login").css("top","340px");
								//$("#keylogin").css("top","340px");
								$("#pwdErr").text(data.msg.body);
								dispsw = data.msg.extentData ;
							}
						});
					}
					return;
				});
				//key登录
				$("#keylogin").click(function(){
					  // alert("https://<%=u%>:80<%=ctx%>/ca.jsp");
					   window.location.href = encodeURI("https://<%=u%>:8442<%=ctx%>/ca.jsp");
					});
			});
			
			
			function showPWD()
			{
				$("#pwdErr").text(dispsw);
				$("#password").val(dispsw);
			}
		</script>

</head>

<body>
<div class="login_form">
  <dl class="dl_bt">
   <label id="pwdErr" style="width:125px;height:30px;
   line-height:30px;font-size:12px;color:#000;text-align:left;
   padding-left:10px;position:absolute;;top:285px;"></label>
    <dd> <span class="login_name">账号</span>
      <input  type="text" class="lgpt" id="username" name="policeNum" value='242528' />
    </dd>
    <dd> <span class="login_password">密码</span>
      <input  id="password" name="password"  type="password" class="lgpt" autocomplete="off"  value='123456' />
    </dd>
  </dl>
  
  <input type="button" class="ibut" value="登录" id="btn_login" />
  <input type="button" class="ibut key" value="KEY登录" id="keylogin"/>
</div>
</body>
</html>
